<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'

const showPage = ref(true)

function beforeleave() {
  showPage.value = false
  setTimeout(() => {
    showPage.value = true
  }, 0);
}
</script>

<template>
  <div class='painting'>
    <NavBar>123</NavBar>
    <text>测试阻止返回的页面</text>
    <!-- 阻止返回 -->
    <!-- 注意一定要用v-if 才可以，不然即使showPage1设置为false，第二次也会直接返回 -->
    <view class="" v-if="showPage">
      <page-container :show="showPage" :overlay="false" @beforeleave="beforeleave"></page-container>
    </view>
    <Tabbar :active="1"></Tabbar>
  </div>
</template>

<style lang='scss' scoped>
.painting {}
</style>